import "../lib/node_modules/jquery/dist/jquery.min.js";
import "../config/base.js";
; (function ($) {
    "use strict"
    var _global;
    var Toast = function (opt) {
        return new T(opt);
    }
    class T {
        constructor(opt) {
            opt && opt.container && (this.container = opt.container);
        }
        // Always escape HTML for text arguments!
        escapeHtml(html) {
            const div = document.createElement('div');
            div.textContent = html;
            return div.innerHTML;
        }
        // Custom function to emit toast notifications
        notify(message, variant = 'primary', duration = 3000, icon = 'info-circle') {
            const alert = Object.assign(document.createElement('sl-alert'), {
                variant,
                countdown: "ltr",
                closable: true,
                duration: duration,
                innerHTML: `
        <sl-icon name="${icon}" slot="icon"></sl-icon>
        ${this.escapeHtml(message)}
      `
            });
            document.body.append(alert);
            return alert.toast();
        }
    }

    //将插件对象暴露给全局对象
    _global = (function () { return this || (0, eval)('this'); }());
    if (typeof module !== "undefined" && module.exports) {
        module.exports = Toast;
    } else if (typeof define === "function" && define.amd) {
        define(function () { return Toast; });
    } else {
        !('Toast' in _global) && (_global.Toast = Toast);
    }
})(jQuery);
